/**
 @Author Zhenglinbin
 @Date 2021/2/27
 **/
export default {
    gridAuto: {
        mounted: (el: HTMLElement) => {
            if(el) {
                //balance2(el)
            }
        }
    },
    gridModal: {
        mounted: (el: HTMLElement) => {
            if(el) {
                let content = document.getElementsByClassName('ant-modal-wrap');
                if(!content || content.length < 1) return
                balance(el)
            }
        }
    }
}
const balance = (el: HTMLElement) => {
    const gridClass = 'vxe-table vxe-table--render-default';
    if(el.className.includes(gridClass)) {
        const parent = el.parentElement;
        if(!parent) return
        let children: any = parent.children;
        if(!children || children.length < 1) return;

        if(!parent.style.height) parent.style.height = '700px'
        let otherHeight: number = 0;

        for(let i = 0; i < children.length; i++) {
            const item: HTMLElement = children[i];
            if((item.className as string) !== el.className) {
                otherHeight += item.offsetHeight;
            }
        }
        el.style.height = `calc(100% - ${otherHeight}px)`
    }
}
